/*
 * @Author: 肖思汗 
 * @Date: 2025-06-16 09:45:46 
 * @Last Modified by: 肖思汗
 * @Last Modified time: 2025-07-11 17:20:11
 */

import { makeAutoObservable } from "mobx";

class PreView2D3DStore {
    constructor() {
        makeAutoObservable(this, {}, { deep: false });
    }

    show = false;
    setShow(show: boolean) {
        this.show = show;
        this.setShowType("2D");
        this.setActiveMockup(0);
        setTimeout(() => {
            this.setShowType("2D");
            this.setActiveMockup(0);
        }, 1000);
    }

    showType: "2D" | "3D" = "2D";
    setShowType(type: "2D" | "3D") {
        this.showType = type;
    }


    //相机的距离
    cameraDistance = 10
    setCameraDistance(d: number) {
        this.cameraDistance = d;
    }

    //上身效果的数量
    mockupCount = 0;
    setMockupCount(c: number) {
        this.mockupCount = c;
        this.setActiveMockup(-1);
    }

    //每个颜色对应上身效果的数量
    colorMockupCount = 0;
    setColorMockupCount(c: number) {
        this.colorMockupCount = c;
        this.setActiveMockup(-1);
    }

    //选中的上身效果
    activeMockup = -1;
    setActiveMockup(i: number) {
        this.activeMockup = i;
    }

    //上一个上身效果
    prevMockup() {
        this.activeMockup = (this.activeMockup + (this.mockupCount + this.colorMockupCount) - 1) % (this.mockupCount + this.colorMockupCount);
    }

    //下一个上身效果
    nextMockup() {
        this.activeMockup = (this.activeMockup + 1) % (this.mockupCount + this.colorMockupCount);
    }


}

const preView2D3DStore = new PreView2D3DStore();

export default preView2D3DStore;


